package com.dqx.haoqiu.mvp.utils;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;

import com.dqx.haoqiu.mvp.common.constant.IConstants;
import com.dqx.haoqiu.mvp.module.guide.GuideActivity;
import com.dqx.haoqiu.mvp.module.launch.link.LinkActivity;
import com.dqx.haoqiu.mvp.module.login.LoginActivity;
import com.dqx.haoqiu.mvp.module.user.UserActivity;

public class Navigation {
    /**
     * 打开第3方链接页面
     *
     * @param context
     * @param url
     */
    public static void openLink(Context context, String title, String url) {
        Intent intent = new Intent(context, LinkActivity.class);
        intent.putExtra(IConstants.TITLE, title);
        intent.putExtra(IConstants.URL, url);
        context.startActivity(intent);
    }

    /**
     * 打开引导页
     *
     * @param context
     */
    public static void openGuide(Context context) {
        Intent intent = new Intent(context, GuideActivity.class);
        context.startActivity(intent);
    }

    /**
     * 打开“登录”页面
     *
     * @param activity
     */
    public static void openLogin(Activity activity) {
        Intent intent = new Intent(activity, LoginActivity.class);
        intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
        activity.startActivity(intent);
    }

    /**
     * 打开用户页面
     *
     * @param context
     */
    public static void openUser(Context context) {
        Intent intent = new Intent(context, UserActivity.class);
        context.startActivity(intent);
    }
}
